import { requestClient } from '#/api/request';

export interface PageFetchParams {
  page: number;
  limit: number;

  [key: string]: any;
}

/**
 * 分页查询菜单列表
 * @param params
 */
export async function getMenuPageApi(params?: PageFetchParams) {
  return requestClient.get<string[]>(`/menu`, { params });
}

/**
 * 获取菜单详情
 * @param id
 */
export async function getMenuInfoApi(id: string) {
  return requestClient.get(`/menu/${id}`);
}

/**
 * 添加菜单
 * @param data
 */
export async function storeMenuApi(data: any) {
  return requestClient.post(`/menu`, data);
}

/**
 * 编辑菜单
 * @param id
 * @param data
 */
export async function updateMenuApi(id: string, data: any) {
  return requestClient.put(`/menu/${id}`, data);
}

/**
 * 删除菜单
 * @param id
 */
export async function deleteMenuApi(id: string) {
  return requestClient.delete(`/menu/${id}`);
}

/**
 * 修改状态
 * @param id
 */
export async function setMenuStatusApi(id: string) {
  return requestClient.put(`/menu/${id}/setStatus`);
}
